<!doctype html>  <!--视频课程>课程分类>课程列表>-->
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>Bootstrap 101 Template</title>
    <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/css/common.css">
</head>
<body>
<!-- 顶部-->
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">长乐未央</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="categories.html">视频课程 <span class="sr-only">(current)</span></a></li>
            </ul>
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="请填写搜索的课程">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>

<div class="container">
    <div class="page-header">
        <h1>课程列表 <small>Course List</small></h1>
    </div>

    <div class="bs-example" data-example-id="media-alignment">
        <!-- <div class="media">
             <div class="media-left">
                 <a href="courses.html">
                     <img class="media-object" data-src="holder.js/64x64" alt="64x64"
                          src="https://images.clwy.cn/video/course/27/image/a9261f.jpg!thumb" data-holder-rendered="true"
                          style="width: 64px; height: 64px;">
                 </a>
             </div>
             <div class="media-body">
                 <h4 class="media-heading">Top aligned media</h4>
                 <p>1111</p>
             </div>
         </div>-->

    </div>
</div>

<script src="vendor/jquery-3.6.0.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script>
    $(function () {
        var categoryId = localStorage.categoryId;
       /* console.log(categoryId)*/
        var html = ''
        $.get("https://clwy.cn/video/api/v2/categories/" + categoryId + ".json", function (data) {

            $.each(data.courses, function (index, value) {
                html += ' <div class="media">\n' +
                    '            <div class="media-left">\n' +
                    '                <a href="javascript:;" data-id="' + value.id + '">\n' +
                    '                    <img class="media-object" data-src="holder.js/64x64" alt="64x64"\n' +
                    '                         src="' + value.image + '" data-holder-rendered="true"\n' +
                    '                         style="width: 64px; height: 64px;">\n' +
                    '                </a>\n' +
                    '            </div>\n' +
                    '            <div class="media-body">\n' +
                    '                <h4 class="media-heading">' + value.name + '</h4>\n' +
                    '                <p>' + value.updated_at + '</p>\n' +
                    '            </div>\n' +
                    '        </div>'

            })
            $('.bs-example').html(html);

            $(document).on('click', '.media-left a', function () {
                var listId = $(this).data('id');  /*获取当前点击的id值,*/
                localStorage.listId=listId;  /*把获取的值存在本地空间*/
                location.href='courses.html'



            })


        });


    })
</script>
</body>
</html>
